<?php
session_start();$arr = json_decode($_SESSION['arr'],true);$arr['fd'] = $fd = $_POST['fd'];$kht = $arr['kht']??'';$t1 = $arr['t1']??'';
if(!$kht){die('请选择载荷系数');}
$u = round($arr['z2']/$arr['z1'],2);$zh = $arr['zh'];$ze = $arr['ze'];$ze1 = $arr['ze1'];$alow_h = $arr['alow_h'];$d1t3 = ( (2*$kht*$t1) / $fd )*(($u+1)/$u)*( ( ($zh*$ze*$ze1) / $alow_h ) * ( ( ($zh*$ze*$ze1) /$alow_h) ) );$d1t = round(pow($d1t3,1/3),3);$arr['d1t'] = $d1t;
$v = ceil((pi()*$d1t*$arr['n1'])/60000);$arr['v'] = $v;$arr['b'] = $b = $fd*$d1t;$ft1 = floor(( 2 * $arr['t1'] ) / $d1t);$arr['qd'] = floor(($arr['ka']*$ft1)/$b);$_SESSION['brr'] = json_encode($arr);?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="layer/jquery.min.js"></script>
<script src="common/layer/layer.js"></script>
</head>
<style>
   #div1{
        margin: 0 auto;
       width: 600px;
       height:450px;
       background-color:  #F0F0F0;
       align-content: center;
       padding-left: 50px;
       padding-right: 50px;
       padding-top: 50px;
    }
    #div2{

        margin: 30px auto;
            padding-top: 10px;
            width: 300px;
            text-align: center;
    }
</style>
<body>

<hr>

<form action="jieguo.php" method="POST" id="form">
<div id="div1">

    <table style="border: solid black 1px " cell>
        <tr>
            <td><label><input class="fruit" name="it" type="radio" value="6"  checked="checked" />汽轮机</label></td>
            <td><label><input class="fruit" name="it" type="radio" value="8" />金属切削机床</label></td>
            <td><label><input class="fruit" name="it" type="radio" value="8" />航空发动机</label></td>
            <td><label><input class="fruit" name="it" type="radio" value="8" />轻型汽车 </label></td>
            <td><label><input class="fruit" name="it" type="radio" value="8" />载重汽车</label></td>
        </tr>
        <tr>
            <td>  <label><input class="fruit" name="it" type="radio" value="8" />拖拉机</label></td>
            <td>  <label><input class="fruit" name="it" type="radio" value="8" />通用减速器</label></td>
            <td>    <label><input class="fruit" name="it" type="radio" value="7" />锻压机床 </label></td>
            <td>   <label><input class="fruit" name="it" type="radio" value="7" />起重机</label></td>
            <td>       <label><input class="fruit" name="it" type="radio" value="8" />农用机器</label></td>

        </tr>

        <tr>
            <td colspan="5">
                第二组公差组精度：<input id="jingdu" type="text" value="6" style="width: 50px" >
            </td>
        </tr>
        <tr style="height: 20px"></tr>
        <tr>
            <td colspan="2">
                <input type="checkbox" value="1" name="gongchazu1" >第一，三与第三公差组精度不同
            </td>
            <td></td>
                <td colspan="3">
                <input type="checkbox">模数总取第一系列的
        </td>
        </tr>
        <tr style="height: 20px"></tr>
        <tr>
            <td colspan="5">
                第一组公差精度：<input type="text" id="first" style="width: 50px">
            </td>
        </tr>
        <tr>
            <td colspan="5">
                第三组公差精度：<input type="text" id="second" style="width: 50px">
            </td>
        </tr>
        <tr>
            <td colspan="5">
                <p>请输入主动齿轮轴信息</p>
            </td>
        </tr>
        <tr>
            <td colspan="5">
                材料牌号：
                <select>
                    <option value="volvo">45</option>
                    <option value="saab">45Cr</option>
                    <option value="opel">35SiMn</option>
                    <option value="audi">2Cr13</option>
                    <option value="audi">20</option>
                    <option value="audi">Q235</option>
                </select>
                许用应力/MPa
                <select>
                    <option value="35">35</option>
                    <option value="46">46</option>
                    <option value="16">16</option>
                </select>
            </td>
        </tr>
        <tr>
            <td colspan="5">
                <p>请输入从动齿轮轴信息</p>
                材料牌号：
                <select>
                    <option value="volvo">45</option>
                    <option value="saab">45Cr</option>
                    <option value="opel">35SiMn</option>
                    <option value="audi">2Cr13</option>
                    <option value="audi">20</option>
                    <option value="audi">Q235</option>
                </select>
                许用应力/MPa
                <select>
                    <option value="volvo">35</option>
                    <option value="volvo">46</option>
                    <option value="volvo">16</option>
                </select>
            </td>
        </tr>

</table>
<div id="div2">
<input type="button" id="jixu" value="继续" >

<a href="index.php"><input type="button" value="重新选择"></a>


</div>

    </div>
    </form>
</body>
</html>
<script>
  $('.fruit').click(function(){
    var val = $('input:radio[name="it"]:checked').val();
if(val!=null){
    $("#jingdu").attr("value",val);
}
  })

  $('#jixu').click(function(){
     var  val1 = $('input:checkbox[name="gongchazu1"]:checked').val();
      if(val1!=null){
          var first = $('#first').val();
          var second = $('#second').val();
          console.log(first);
          console.log(second);
          if(first == '' && second == ''){
              layer.msg('请选择第一 第二公差')
              return false
          }
      } 
      $('#form').submit();
  })
</script>
<?php
//外齿轮齿形系数
$yfa=[
    '18'=>2.93,
    '30'=>2.55,
    '50'=>2.34,
    '100'=>2.20,
    '200'=>2.15,
    '400'=>2.1,
    '500'=>2.06,
];
?>